package com.lty.jeeg.server.modules.fas.dao;

import java.util.List;
import java.util.Map;

import com.lty.jeeg.server.modules.fas.dto.SurplusLossesDTO;
import com.lty.jeeg.server.modules.fas.vo.SupplierVO;
import org.apache.ibatis.annotations.*;

import org.springframework.stereotype.Repository;

import com.lty.jeeg.server.modules.fas.model.SurplusLosses;

/**
 * @author : xuchen
 * @date : 2019-03-11 09:45:43
 * Description : 盘盈盘亏记录
 */
@Mapper
@Repository
public interface SurplusLossesDao {

    /**
     * 根据ID获取
     * @param id ID
     * @return bean
     */
    SurplusLossesDTO getById(Long id);

    /**
     * 删除
     * @param id ID
     * @return 1/0
     */
    @Update("update fas_surplus_losses set isDeleted = '1' where id = #{id}")
    int delete(Long id);

    /**
     * 修改
     * @param surplusLosses ID
     * @return 1/0
     */
    int update(SurplusLosses surplusLosses);

    /**
     * 保存
     * @param surplusLosses bean
     * @return ID
     */
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into fas_surplus_losses(goodsId, userId, deptId, company, totalNumber, remark, createBy, updateBy, isDeleted) values(#{goodsId}, #{userId}, #{deptId}, #{company}, #{totalNumber}, #{remark}, #{createBy}, #{updateBy}, #{isDeleted})")
    Long save(SurplusLosses surplusLosses);

    /**
     * 计数
     * @param params 筛选条件
     * @return 总数
     */
    int count(@Param("params") Map<String, Object> params);

    /**
     * 列表
     * @param params 筛选条件
     * @param offset 页码
     * @param limit 分页数目
     * @return beanList
     */
    List<SupplierVO> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
